package org.xiangfei.codec;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import org.xiangfei.codec.bean.Auth;
import org.xiangfei.codec.util.ByteObjConverter;

public class AuthEncoder extends MessageToByteEncoder<Auth> {
    @Override
    protected void encode(ChannelHandlerContext ctx, Auth auth, ByteBuf out) throws Exception {
        byte[] datas = ByteObjConverter.objectToByte(auth);
        out.writeBytes(datas);
        ctx.flush();
    }
    
}
